/*
 * PhysicalObject.h
 *
 *  Created on: Aug 10, 2009
 *      Author: Weston Wedding
 */

#ifndef PHYSICALOBJECT_H_
#define PHYSICALOBJECT_H_

#include <SFML/System.hpp>
#include <svl/SVL.h>

typedef     Vec3  Vector;
typedef     float               angle;
typedef     float               scalar;

#include "PhysicalProperties.h"


// TODO: DOCUMENT AND MOVE  pos3D struct TO A MORE APPROPRIATE DATATYPES FILE
struct pos3D
{
        scalar      x;
        scalar      y;
        scalar      z;
};

class PhysicalObject {
    public:
        PhysicalObject();
        PhysicalObject(scalar x, scalar y, scalar z, PhysicalProperties properties);
        ~PhysicalObject();
        bool setAirDensity(float density);
        bool setAirSpeed(Vector airSpeed);
        bool setGroundSpeed(Vector groundSpeed);

    private:
        Vector calculateNetForce();
        Vector calculateThrustForce();
        Vector calculateLiftForce();
        Vector calculateDragForce();
        Vector calculateWeightForce();
        Vector getDynamicPressure();

        // Set by physicalProperties struct
        // These properties are used to figure out all the other stuff
        Vector      unitOrientation;
        scalar      mass;
        scalar      pitchSpeed;
        scalar      yawSpeed;
        scalar      rollSpeed;
        scalar      airDensity;
        scalar      dragCoefficient;  //dL
        scalar      liftCoefficient;  //cL
        Vector      airSpeed;
        scalar      referenceArea;

        Vector      thrust;  // Move to Airplane subclass
        Vector      lift;    // Based on cL and dynamic pressure
        Vector      drag;    // based on dL and dynamic pressure
        Vector      weight;  // based on mass and gravitational constant
        Vector      netForce;  // thrust + lift +  drag + weight
        Vector      special1;  //These two vectors might never be used and do not reflect
        Vector      special2;  // physics.  They are present to allow for additional manipulation
        angle       pitch;
        angle       yaw;
        angle       roll;
        pos3D       coordinates;
        scalar      angleOfAttack;
        Vector      groundSpeed;

        //The variables needed to calculate the various vectors

};

#endif /* PHYSICALOBJECT_H_ */
